The present invention relates to a graphic processing system for graphically synthesizing a solid model, and more particularly, to a shading circuit for shading a plurality of polygons which constitute a solid model to be displayed on a display screen.
In the fields of machine design and body design of vehicles, a graphic processing system is used for graphically synthesizing a solid model. The solid model is synthesized by combining various types of polygons. For example, a complex curved surface of a vehicle body is approximated by a large number of polygons which are defined such that a plurality of points on the curved surface are designated and are connected. For example, when a perspective solid mode is required, only the outlines of polygons are displayed. When the solid model is required to be more substantiated, the surfaces of polygons on the front side are shaded on a screen assuming that the solid model is illuminated with light.
As one of conventional shading techniques, Gouraud shading is known. In the Gouraud shading, vertex data of a plurality of items are prepared for each of polygons constituting a solid mode. Each vertex data represents a three-dimensional position and an intensity (or a luminance) of one of the vertexes of a polygon. The vertex position is defined by coordinates on three orthogonal coordinate axes, e.g., coordinate axes, X, Y, and Z. For example, if a polygon is a triangle, as shown in FIG. 1, vertex data (x1,y1,z1,I1), (x2,y2,z2,I2), and (x3,y3,z3, I3) are prepared for vertexes A, B, and C. (x1,y1,z1), x2,y2,z2), and (x3,y3,z3) are three-dimensional coordinates of vertexes A, B, and C, and I1, I2, and I3 are intensities of vertexes A, B, and C, respectively.
In the display screen, coordinate axes X, Y, and Z respectively extend in the horizontal, vertical, and depth directions. The vertex data are subjected to arithmetic operations necessary for shading the polygon along scan lines on the display screen. In the arithmetic operations, intensities and Z coordinates of points inside the polygon, which are along the scan lines are obtained. The intensity of each point is used to determine the intensity of the pixel corresponding to this point. The Z coordinate each point is used to confirm that this point is located in front of a point of another polygon to be displayed on the screen. The scan lines of the display are set to be parallel to coordinate axis X. A broken line in FIG. 1 is one of the scan lines. The intensities and Z coordinates of points inside the triangular polygon, which are along this scan line, are obtained as follows. In FIG. 1, (Xa,Ya,Za,Ia) and (Xb,Yb,Z,Ib) represent coordinates and intensities at positions where the scan line intersects two points on the polygon edges, i.e., points D and E. Intensity Ia and Z coordinate Za of point D are obtained by interpolating intensity values I2 and I3 and Z coordinate values z2 and z3, respectively, based on the Y coordinate values of points B, D, and C. Intensity Ib and Z coordinate Zb of point E can be obtained by interpolating intensity values I1 and I3 and Z coordinate values z1 and z3, respectively, based on the Y coordinate values of points A, E, and C. (Xp,Yp,Zp,Ip) represent a coordinate and an intensity of arbitrary point P between points D and E. Intensity Ip and Z coordinate Zp of point P can be obtained by interpolating intensity values Ia and Ib and Z coordinate values Za and Zb, respectively, based on the X coordinate values of points D, P, and E. More specifically, Ia, Ib, Ip, Za, Zb, and Zp can be given by the following equations: EQU Ia=I2{(Ya-Y3)/(Y2-Y3)}+I3{(Y2-Ya)/(Y2-Y3)} (1) EQU Ib=I1{(Yb-Y3)/(Y1-Y3)}+I3{(Y1-Yb)/(Y1-Y3)} (2) EQU Ip=Ia{(Xp-Xb)/(Xa-Xb)}+Ib{(Xa-Xp)/(Xa-Xb)} (3) EQU Za=Z2{(Ya-Y3)/(Y2-Y3)}+Z3{(Y2-Ya)/(Y2-Y3)} (4) EQU Zb=Z1{(Yb-Y3)/(Y1-Y3)}+Z3{(Y1-Yb)/(Y1-Y3)} (5) EQU Zp=Za{(Xp-Xb)/(Xa-Xb)}+Zb{(Xa-Xp)/(Xa-Xb)} (6)
In the Gouraud shading, a divider must be frequently used. An operation speed of the divider is normally low. For example, if the calculations of equations (3) and (6) are performed for each of the points corresponding to the pixels on the scan line, they require a very long time. For this reason, the intensities and Z coordinates of the points are usually obtained using .DELTA.I/.DELTA.X and .DELTA.Z/.DELTA.X. .DELTA.I/.DELTA.X represents the change of intensity for each unit change in the X coordinate and is calculated from equations (1) and (2). .DELTA.Z/.DELTA.X represents the change of the Z coordinate for each unit change in the X coordinate and is calculated from equations (4) and (5). In this case, the intensity and Z coordinate of each point can be obtained by adding .DELTA.I/.DELTA.X and .DELTA.Z/.DELTA.X to the intensity and Z coordinate of the point corresponding to the pixel before the unit change in the X coordinate. However, calculations for obtaining changes .DELTA.I/.DELTA.X and .DELTA.Z/.DELTA.X must be performed for each scan line, and all the calculations still require a long time.
The X and Y coordinates of a pixel whose intensity is to be determined are normally generated by a digital differential analyzer. However, since the operation speed for obtaining changes .DELTA.I/.DELTA.X and .DELTA.Z/.DELTA.X is low, it is difficult to associate the divider and the digital differential analyzer to achieve pipeline processing.